﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml;
using System.IO;
using Newtonsoft.Json;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Data.Odbc;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Text.RegularExpressions;

/// <summary>
/// Cake 的摘要说明
/// </summary>
public class Cake
{
    wsyS_CodeSet_1 CodeSL1 = new wsyS_CodeSet_1();
    wxyS_SQLsDataJsons_1 JsonSL1 = new wxyS_SQLsDataJsons_1();
    private String JSonDZ1 = @"\File\json\Code.json";
    DateTime now = DateTime.Now;
    public Cake()
	{
		//
		// TODO: 在此处添加构造函数逻辑
		//
	}
    public String CCake(String result)
    {
        String fh1 = "";
        String nStr1 = "";
        wxyS_SQLsDataJsons_1.RootObject rb1 = JsonSL1.JsonRO1(JSonDZ1.ToString());
        
		nStr1 = nStr1 + rb1.standardcode.sys_code;
		nStr1 = nStr1 + rb1.standardcode.Sys_cut;
		nStr1 = nStr1 + CodeSL1.wxyS_RandFA1("ABCDEFGHIJKLMNOPQRSTUVWYZ", 4) + CodeSL1.wxyS_RandIntFA1(6);
        nStr1 = nStr1 + rb1.standardcode.Sys_cut;
        nStr1 = nStr1 + String.Format("{0:yyyyMMddHHmmss}", now);
        nStr1 = nStr1 + rb1.standardcode.Sys_cut;
        nStr1 = nStr1 + CodeSL1.wxyS_RandIntFA1(6) + CodeSL1.wxyS_RandFA1("ABCDEFGHIJKLMNOPQRSTUVWYZ", 2);
        nStr1 = nStr1 + rb1.standardcode.Sys_cut;
        if (result.ToString() == "1")
        {
            nStr1 = nStr1 + rb1.standardcode.sys_userstr;
        }else {
            int cd1 = rb1.standardcode.sys_userstr.Length;
            int cd2 = result.Length;
            int cd3 = 0;
            if (cd1 > cd2){
                cd3 = cd1 - cd2;
            }
            String cd4 = "";

            int BL1i = 0;
            int BL1ii = cd3;
			while(BL1i<BL1ii){
				cd4 = cd4.ToString() + "0";
				BL1i = BL1i + 1;
			}//while

            cd4 = cd4 + result.ToString();
			if(cd4.Length>30){
                cd4 = cd4.Substring(0, 29);
			}//
			nStr1 = nStr1 + cd4;
        }//
        nStr1 = nStr1 + rb1.standardcode.Sys_cut;
		nStr1 = nStr1 + rb1.standardcode.sys_software;
		nStr1 = nStr1 + rb1.standardcode.Sys_cut;
        nStr1 = nStr1 + rb1.standardcode.sys_tailcode;

        fh1 = nStr1;
        return fh1;
    }//CCake
    public String CakeTM1(String TStr1){
        String fh1 = "";
        String nStr1 = "";

		int ws  = 10;
		int cd1 = TStr1.Length;
		int cd2 = 0;
		if(cd1<ws){
			cd2 = ws - cd1;
		}
		String cd3 = "";
		int BL1i2 = 0;
		int BL1ii2 = cd2;
		while(BL1i2<BL1ii2){
			cd3 = cd3 + "0";
			BL1i2 = BL1i2 + 1;
		}//while
		nStr1 = TStr1.ToString() + cd3.ToString();
		if(nStr1.Length>ws){
			nStr1 = nStr1.Substring(0,ws);
		}//
        nStr1 = nStr1 + String.Format("{0:yyyyMMddHHmmss}", now) + CodeSL1.wxyS_RandIntFA1(10) + "JL0001";
        fh1 = nStr1;
		return fh1;
	}//CakeTM1

}//